﻿<?php
use think\Config;
?>
<!doctype html>
<html>

<head>
    <meta charset="utf-8">
    <title><?php echo Config::get('appname');?></title>
    <link href="/static/css/default.css" rel="stylesheet" type="text/css">
    <link href="/static/css/style/green.css" rel="stylesheet" type="text/css" id='link'>
    <style>
        .loginbtn {
            width: 306px;
            height: 40px;
            line-height: 40px;
            text-align: center;
            display: block;
            color: #fff;
            font-size: 16px;
            background: #227447;
            display: block;
            color: #ffffff;
        }
    </style>
</head>

<body>

    <!--loginbox start-->
    <div class="loginbox">

        <div class="login">
            <div class="loginlogo"></div>
            <form name="form1" action="/Index/Index/login" method="post">
                <div class="loginpanel">
                    <h2>找回密码</h2>
                    <table class="formtable">

                        <tbody>

                            <tr>
                                <td class="tlabel">请输入手机号码</td>
                                <td>
                                    <input type="text" class="loginuser" id="phone" name="username" placeholder="">

                                </td>

                            </tr>

                            <tr>
                                <td class="tlabel">验证码</td>
                                <td>
                                    <input type="text" class="loginuser" id="code" name="username" style="width:140px;"
                                        placeholder="">
                                    <a href="#" class="loginbtn" id="getcode"
                                        style="color:#ffffff;float: left;width:120px;font-size: 14px;">点击获取</a>
                                </td>

                            </tr>



                            <tr>
                                <td class="tlabel">


                                </td>
                                <td>
                                    <a href="#" class="loginbtn" id="sub" style="color:#ffffff;width:130px">提交</a>
                                   
                                </td>

                            </tr>
                            <tr>
                                <td>
                                       
                                </td>
                                <td>
                                        <a href='/Index/Index/login' style="float:left;display:block;">点击返回首页</a>
                                </td>
                            </tr>



                        </tbody>

                    </table>

                </div>
            </form>

            <div class="logininfo"><?php echo Config::get('systeminfo');?></div>
        </div>

    </div>
    <!--loginbox end-->

</body>
<script type="text/javascript" src="/static/js/jquery.js"></script>
<script type="text/javascript" src="/static/js/common.js"></script>
<script type="text/javascript" src="/static/js/skin.js"></script>
<script src="/static/js/layer/layer.js"></script>
<script type="text/javascript">
    var height = $(window).height();
    $(".login").css("padding-top", height / 2 - $(".login").height() / 2);
    $(window).resize(function () {
        $(".login").css("padding-top", $(window).height() / 2 - $(".login").height() / 2);
    });
    var timer;
    var disabled=true;
    $(function () {
    
        $("#getcode").click(function () {
            var phone = $("#phone").val();
            if (!(/^1[34578]\d{9}$/.test(phone))) {
                layer.msg("手机号有误");
                disabled = true;
            } else if (disabled) {
                disabled = false;

                $.post('/Wx/Index/getcode', {
                    "phone": phone
                }, function (data) {
                    if (data.status == 200) {
                        var num = 61;

                        timer = setInterval(function () {
                            num--;
                            if (num <= 0) {
                                clearInterval(timer);
                                $("#getcode").html("重新发送");

                                disabled = true;

                            } else {
                                $("#getcode").html(num + "s");

                                disabled = false;
                            }
                        }, 1000)
                    } else {
                        layer.msg(data.message);
                    }
                });



            }



        });

        $("#sub").click(function () {
            var phone = $("#phone").val();
            var code = $("#code").val();
            if(phone==""){
                layer.msg("请输入手机号码");
            }else if(code==""){
                layer.msg("请输入手机验证码");
            }else{
                $.post("/Index/Index/findpass",{phone:phone,code:code},function(data){
                    if(data.status==200){
                        layer.alert(data.message);
                    }else{

                        layer.alert(data.message);
                    }


                })
            }

        });

    });
</script>

</html>